# Grade_To_Letter_Converter_Improved.py # # Description: Write a Letter Grade converter that # converts a grade into letter grade: # A -> 90 to 100 (inclusively) # B -> 80 to 89 # C -> 70 to 79 # D -> 60 to 69 # E -> 50 to 59 # F -> 0 to 49 # # Author: Anne Lavergne # Date: M Jan. 22 2024 # Ask the user for a grade and read the grade prompt = "Please, enter a grade (integer between 0 and 100)? " theGrade = int(input(prompt).strip()) # User input validation if theGrade < 0 or theGrade > 100: print("The grade you entered is either < 0 or > 100!") print("Please, try again!") else: # Convert grade to letter grade # If grade is between 90 and 100 (inclusively), the letter A if theGrade >= 90: print("A") # If grade is between 80 and 89 (inclusively), the letter B elif theGrade >= 80: print("B") # If grade is between 70 and 79 (inclusively), the letter is C elif theGrade >= 70: print("C") # If grade is between 60 and 69 (inclusively), the letter is D elif theGrade >= 60: print("D") # If grade is between 50 and 59 (inclusively), the letter is E elif theGrade >= 50: print("D") # If grade is between 0 and 49 (inclusively), the letter is F else: print("F") print("Bye!")